package WaiBao;

import java.util.Arrays;

public class WangCaiZhi {
    public static void main(String[] args) {
        String[] name = {"李武(班长)", "李成(组织委员)", "小李(学习委员)", "李良(纪律委员)", "李超平", "李广", "李佳木", "李俊池", "李建通", "李金龙", "李俊达", "张静怡",
                "谢宝庆", "李金城", "李建兵", "李俊麦", "张星光", "张秀明", "徐秀伟", "李夏文", "李学义", "王穴播", "王兴华", "张压抑", "张霞影", "李学明", "李欣怡", "李秀杰",
                "李晓丽", "王才智(学生)"};//考生本人: 王才智(学生)
        int[] Age = {21,20,11, 20, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18,18, 20, 18,20};//考生年龄：20岁

        double[] congqian1 = {60, 82, 94, 80, 79, 69, 78, 89, 81, 90, 90, 87, 85, 71, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 78, 81, 95};
        double[] congqian2 = {75, 76, 79, 71, 88, 74, 80, 74, 90, 90, 94, 76, 86, 75, 65, 65, 86, 79, 64, 68, 92, 71, 95, 85, 75, 84, 79, 84, 91, 95};
        double[] congqian3 = {74, 90, 91, 85, 71, 69, 78, 89, 80, 61, 93, 87, 85, 75, 65, 68, 69, 89, 96, 93, 92, 81, 95, 95, 79, 84, 77, 76, 79, 96};


        double haunxiang1;//代表每个学生的总分
        double haunxiang2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            haunxiang1 = congqian1[i] +congqian2[i] +congqian3[i];
//            haunxiang2 = (  haunxiang1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + haunxiang1);
//            System.out.println(name[i] + "的平均分为:" + haunxiang2);
//        }

        double xiaitan1 = 0, xiaitan2 = 0;
        double[] jiuzhe = new double[30];
//        for (int i = 0; i < 30; i++) {
//            xiaitan1  = congqian1[i] + congqian2[i] + congqian3[i];
//            xiaitan2 = (xiaitan1* 1.0) / 3;
//            jiuzhe[i] = xiaitan2;
//        }
//
//        for (int i = 0; i <jiuzhe.length - 1; i++) {
//            for (int j = 0; j < jiuzhe.length - i - 1; j++) {
//                if (jiuzhe[j] < jiuzhe[j + 1]) {
//                    double tep = jiuzhe[j];
//                    jiuzhe[j] =jiuzhe[j + 1];
//                    jiuzhe[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(jiuzhe[i]);
//        }


        double yitian1 = 0,yitian2 = 0, yitian3 = 0;//计算每门课的平均分
        double banqiu1 = 0,banqiu2 = 0, banqiu3 = 0;//计算每门课标准差
        double shenying1 = 0,shenying2 = 0,shenying3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < congqian1.length; i++) {
            sum2+=congqian1[i];
        }
        yitian1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+yitian1);
        double Sum = 0;
        for (int i = 0; i <congqian2.length; i++) {
            Sum+=congqian2[i];
        }
        yitian2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yitian2);
        double sum = 0;
        for (int i = 0; i <congqian3.length; i++) {
            sum+=congqian3[i];
        }
        yitian3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+yitian3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <congqian1.length; i++) {
            c1+= (congqian1[i] -yitian1)*(congqian1[i] -yitian1);
        }
        banqiu1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+banqiu1);

        for (int i = 0; i <congqian2.length; i++) {
            c2+= (congqian2[i] -yitian2)*(congqian2[i] -yitian2);
        }
        banqiu2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+banqiu2);

        for (int i = 0; i <congqian3.length; i++) {
            c3+= (congqian3[i] -yitian3)*(congqian3[i] - yitian3);
        }
        banqiu3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+banqiu3);
////////
////////
//        Arrays.sort(congqian1);
//        Arrays.sort(congqian2);
//        Arrays.sort(congqian3);
//        shenying1 =( congqian1[14]+congqian1[15])*1.0/2;
//        shenying2 =(congqian2[14]+congqian2[15])*1.0/2;
//        shenying3 =( congqian3[14]+congqian3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+shenying1);
//        System.out.println("微生物学的中位数为:"+shenying2);
//        System.out.println("人体组织解剖学的中位数为:"+shenying3);



    }
}
